package com.buddy.jni.demo06;

/**
 * 访问Java对象实例的变量
 */
public class JNIInstanceVariable {
    static {
        System.loadLibrary("jni_instance_variable");
    }

    // Instance variables
    private int number = 88;
    private String message = "Hello from Java";

    // Declare a native method that modifies the instance variables
    private native void modifyInstanceVariable();

    public static void main(String args[]) {
        JNIInstanceVariable jniInstanceVariable = new JNIInstanceVariable();
        jniInstanceVariable.modifyInstanceVariable();
        System.out.println("In Java, int is " + jniInstanceVariable.number);
        System.out.println("In Java, String is " + jniInstanceVariable.message);
    }
}
